﻿using Microsoft.AspNetCore.Mvc;

namespace Magic.Web.Entry;

/// <summary>
/// 文件服务类
/// </summary>
public class FileController: BaseController
{
    private readonly IFileService _fileService;

    public FileController(IFileService fileService)
    {
        _fileService = fileService;
    }
    /// <summary>
    /// 上传头像
    /// </summary>
    /// <param name="file"></param>
    /// <param name="uuid"></param>
    /// <returns></returns>
    [HttpPost("/admin/ajax/upload")]
    public async Task<dynamic> UpLoadAvatar(IFormFile file,[FromQuery]string uuid)
    {
        var fileOut= await _fileService.UploadAvatar(file, uuid);
        return new
        {
            file = fileOut
        };
    }
}
